/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package BLL;

import DBH.DBHelper;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;

/**
 *
 * @author Huy
 */
public class Tienluong {

    private DBHelper obj = new DBHelper();
    private Vector v;
    private String chucvu;
    private String luong;
     public Tienluong(){}
      public Tienluong(String chucvu,String luong){
       
        this.chucvu=chucvu;
        this.luong = luong;
    }
       public  Vector getAlltienluong() throws SQLException
    {
        Vector v = new Vector();
        try 
        {
            ResultSet rs = obj.executeQuery("sp_getAlltienluong");
            while(rs.next())
            {    Tienluong t = new Tienluong();
            
                t.setChucvu(rs.getString(1));
                t.setLuong(rs.getString(2));
                
                v.add(t);  
            }
        } 
        catch(SQLException sqle) 
        {            
        }
        return v;        
    }
       public int Inserttienluong(Tienluong t) throws SQLException
    {
        int i=0;
        try
        {
            Vector paramList=new Vector();
            paramList.add(t.getChucvu());
            paramList.add(t.getLuong());
            
            i=DBHelper.executeUpdate("sp_Inserttienluong",paramList);
        }
        catch(SQLException sqlex)
        {
            
        }
        return i;
    }
  public int Updatetienluong(Tienluong t) throws SQLException
    {
        int i=0;
        try
        {
            Vector paramList=new Vector();
            paramList.add(t.getChucvu());
            paramList.add(t.getLuong());         
            i=DBHelper.executeUpdate("sp_Updatetienluong",paramList); 
        }
        catch(SQLException sqlex)
        {
            
        }
        return i;
    }
   public int Deletetienluong(String chucvu) throws SQLException
    {
        int i=0;
        try
        {
            Vector paramList=new Vector();
            paramList.add(chucvu);            
            i=DBHelper.executeUpdate("sp_Deletetienluong",paramList);
        }
        catch(SQLException sqlex)
        {
            
        }
        return i;
    }  
    /**
     * @return the chucvu
     */
    public String getChucvu() {
        return chucvu;
    }

    /**
     * @param chucvu the chucvu to set
     */
    public void setChucvu(String chucvu) {
        this.chucvu = chucvu;
    }

    /**
     * @return the luong
     */
    public String getLuong() {
        return luong;
    }

    /**
     * @param luong the luong to set
     */
    public void setLuong(String luong) {
        this.luong = luong;
    }
}
